package me.a02abstractdemo2;

public class Test {
    public static void main(String[] args) {
        Frog f = new Frog("小绿", 1);
        f.drink();
        f.eat();
    }
}

abstract class Animal {
    private String name;
    private int age;

    public Animal() {
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void drink() {
        System.out.println(name + "在喝水");
    }

    public abstract void eat();
}

class Frog extends Animal {
    public Frog() {
    }

    public Frog(String name, int age) {
        super(name, age);
    }

    @Override
    public void eat() {
        System.out.println("青蛙在吃虫子");
    }
}

class Dog extends Animal {
    public Dog() {
    }

    public Dog(String name, int age) {
        super(name, age);
    }

    @Override
    public void eat() {
        System.out.println("狗仔吃骨头");
    }
}

class Sheep extends Animal {

    @Override
    public void eat() {
        System.out.println("赡养在吃草");
    }
}
